<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>010.函数.html</title>
</head>
<body>
    
</body>
<script>
    function print(){
        // console.log('print');
        return 'ret print';
    }

    var a01 = new print();
    console.log(a01);

    let sum = new Function("num1", "num2", "return num1 + num2");
    console.log('理解js对象：',sum(1,2));

    function foo() {} 
    console.log('什么意思？什么规定？？ ：',foo.bind(null).name);


    function fff(a1,a2,a3){
        console.log(arguments);
        console.log(typeof arguments );

    }

    fff(1,2,3);

    console.log('============================================================');

    window.color = 'red'; 
    let o = { 
        color: 'blue' 
    }; 
    let sayColor = () => console.log(this.color); 
    sayColor(); // 'red' 
    o.sayColor = sayColor; 
    o.sayColor(); // 'red'

    let o01 = new Object();
    o01.color = 'pink';
    o01.sayColor = ()=>{
            console.log(this.color);
        } 
    console.log(o01);
    o01.sayColor();  // red

    console.log('+++++++++++');

    function f02(a1,a2,a3){
        
        console.log(new.target);
    }

    f02();

    class Obj02 {
        constructor(){
            console.log(new.target);
            this.color = 'pink02'
        }
        sayColor = ()=>{
            console.log(this.color);
        } 
    }
    // Obj02();

    let o02 = new Obj02();
    o02.sayColor();

</script>
</html>